<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<style>
			body { margin: 0; }
		</style>
		<script src="../utils/setTitle.js"></script>
	</head>
	<body>
		<script type="importmap">
			{
				"imports": {
					"three": "https://unpkg.com/three/build/three.module.js"
				}
			}
		</script>
		<script type="module">
			import * as THREE from 'three';
			const scene = new THREE.Scene();
			const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
			
			const length = 12, width = 8;

			const shape = new THREE.Shape();
			shape.moveTo( 0,0 );
			shape.lineTo( 10, 0 );
			shape.lineTo( 10, 10 );
			shape.lineTo( 20, 10 );
			shape.lineTo( 20, 20 );
			shape.lineTo( 30, 20 );
			shape.lineTo( 30, 30 );
			shape.lineTo( 0, 0 );
			const extrudeSettings = {
				steps: 2,
				depth: 16,
				bevelEnabled: true,
				bevelThickness: 1,
				bevelSize: 0,
				bevelOffset: 0,
				bevelSegments: 1
			};

			const geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );
			const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
			const mesh = new THREE.Mesh( geometry, material ) ;
			scene.add( mesh );
			camera.position.z = 50;
			const renderer = new THREE.WebGLRenderer();
			renderer.setSize( window.innerWidth, window.innerHeight );
			document.body.appendChild( renderer.domElement );
			function animate() {
				requestAnimationFrame( animate );
				mesh.rotation.x += 0.01;
				mesh.rotation.y += 0.01;
				renderer.setSize( window.innerWidth, window.innerHeight );
				renderer.render( scene, camera );
			}
			animate();
		</script>
	</body>
</html>